<template>
    <div>
          <el-form :model="ruleForm" :rules="rules">
                    <el-form-item label="密码" prop="pass">
                         <el-input  v-model="ruleForm.pass" show-password autocomplete="off"></el-input>
                         <!-- <el-input type="password" v-model="ruleForm.pass" autocomplete="off" ></el-input> -->
                    </el-form-item>
                    <el-form-item label="确认密码" prop="checkPass">
                        <!-- <el-input type="password" v-model="ruleForm.checkPass" autocomplete="off"></el-input> -->
                          <el-input  v-model="ruleForm.checkPass" show-password autocomplete="off"></el-input>
                    </el-form-item>
          </el-form>
         
        
    </div>
</template>

<script>
import { METHODS } from 'http';
export default {
  data(){
         var validatePass = (rule, value, callback) => {
        if (value === '') {
          callback(new Error('请输入密码'));
        } else {
          if (this.ruleForm.checkPass !== '') {
            this.$refs.ruleForm.validateField('checkPass');
          }
          callback();
        }
      };
      var validatePass2 = (rule, value, callback) => {
        if (value === '') {
          callback(new Error('请再次输入密码'));
        } else if (value !== this.ruleForm.pass) {
          callback(new Error('两次输入密码不一致!'));
        } else {
          callback();
        }
        }
      return{
          ruleForm: {
          pass: '',
          checkPass: '',
        },
        rules: {
          pass: [
            { validator: validatePass, trigger: 'blur' },
            { min: 5, message: '长度在不能小于5个字符' }
          ],
          checkPass: [
            { validator: validatePass2, trigger: 'blur' }
          ],
        },
      }
  },
  mounted:function(){
 
  },
  methods:{
      
  }
}
</script>

<style>

</style>
